package cn.monkey.chat.server.admin.domain.account;

import cn.monkey.chat.server.data.account.Account;
import cn.monkey.chat.server.data.account.QAccount;
import org.springframework.data.querydsl.ReactiveQuerydslPredicateExecutor;
import org.springframework.data.repository.NoRepositoryBean;
import org.springframework.data.repository.reactive.ReactiveCrudRepository;
import reactor.core.publisher.Mono;

@NoRepositoryBean
public interface AccountRepository extends ReactiveCrudRepository<Account, String>,
        ReactiveQuerydslPredicateExecutor<Account> {
    default Mono<Account> findByUsername(String username) {
        QAccount qAccount = QAccount.account;
        return this.findOne(qAccount.username.eq(username));
    }
}
